<div class="films index">
	<?php if(AuthComponent::user())
			echo $this->Html->link(__('Add film'), array('action' => 'add'), array('class'=>'new')); ?>
	<h2><?php echo __('Listado de peliculas');?></h2>	
	<table cellpadding="0" cellspacing="0">
	<?php
	$cant=0;
	foreach ($films as $film): ?>	
	<?php if($cant%3==0)
			if($cant==0)
				echo '<tr>';
			else
				echo '</tr><tr>';
		  $cant++;
	?>
		<td><div class="title"><?php echo h($film['Film']['title']); ?>&nbsp;</div>
			<div><?php echo $this->Html->image($film['Film']['Image'],array('alt' => 'No se encuentra la imagen', 'url' => '/films/view/'.$film["Film"]["id"], 'class' =>'imagen')); ?></div>
			<div class="sinopsis">
				<?php echo substr($film['Film']['synopsis'],0,100).'...';?>
				<span><?php echo $this->Html->Link('More',array('action'=>'view',$film['Film']['id']));?></span>
				
			<div>
		<?php if(AuthComponent::user()):?>
			<div class="actions edicion">
				<?php echo $this->Html->link(__('View'), array('action' => 'view', $film['Film']['id'])); ?>
				<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $film['Film']['id'])); ?>
				<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $film['Film']['id']), null, __('Are you sure you want to delete # %s?', $film['Film']['id'])); ?>
			</div>
			</td>	
		<?php endif?>
<?php endforeach; 
	if($cant%3==1)
		echo '<td></td><td></td>';
	else
		if($cant%3==2)
			echo '<td></td>';
?>

	</tr>
	</table>
	<p>
	<?php
	$this->Paginator->options(array('end'=>6));
	echo $this->Paginator->counter(array(
	'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
	));
	?>	</p>

	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>

